// Fading RGB led

int value1 = 0;
int value2 = 0;
int value3 = 0;

int sourcePin = 13;
int ledPinB = 11;   
int ledPinR = 10;   
int ledPinG = 9;   
 
void setup() 
{ 
  pinMode(sourcePin, OUTPUT); 
} 
 
void loop() 
{ 
  digitalWrite(sourcePin, LOW);
  
  for(value1 = 0, value2 = 50 ; value1 <= 50; value1+=1, value2-=1) // fade in (from min to max) 
  {
    analogWrite(ledPinR, value1);            
    analogWrite(ledPinG, value2);
    delay(50);                            
  }
  delay(1000);
  for(value1 = 0, value2 = 70 ; value1 <= 70; value1+=1, value2-=1) // fade in (from min to max) 
  {
    analogWrite(ledPinR, value2);            
    analogWrite(ledPinB, value1);
    delay(100);                             
  }
  delay(1000);
  for(value1 = 0, value2 = 70 ; value1 <= 70; value1+=1, value2-=1) // fade in (from min to max) 
  {
    analogWrite(ledPinG, value1);           
    analogWrite(ledPinB, value2);
    delay(100);                            
  }
  delay(1000);
} 
